﻿
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<link href="~/Content/index.css" rel="stylesheet" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
<script src="../../Scripts/jquery-1.7.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#PROVINCE_CODE").change(function () {
            $("#DISTRICT_CODE").empty();
            $("#COMMUNE_CODE").empty();
            $("#DISTRICT_CODE").append('<option value="' + '-1' + '">' +
                 '-- Chọn Huyện --' + '</option>');
            $("#COMMUNE_CODE").append('<option value="' + '-1' + '">' +
                 '-- Chọn Xã --' + '</option>');
            $.ajax({
                type: 'POST',
                url: '@Url.Action("GetAdministrativeUnit1")',

                dataType: 'json',

                data: {
                    code: $("#PROVINCE_CODE").val(),
                    level: '2'
                },

                success: function (states) {
                    $.each(states, function (i, state) {
                        $("#DISTRICT_CODE").append('<option value="' + state.Value + '">' +
                             state.Text + '</option>');

                    });
                },
                error: function (ex) {
                    alert('Failed to retrieve states.' + ex);
                }
            });
            return false;
        })
        $("#DISTRICT_CODE").change(function () {
            $("#COMMUNE_CODE").empty();
            $("#COMMUNE_CODE").append('<option value="' + '-1' + '">' +
                '-- Chọn Xã --' + '</option>');
            $.ajax({
                type: 'POST',
                url: '@Url.Action("GetAdministrativeUnit1")',

                dataType: 'json',

                data: {
                    code: $("#DISTRICT_CODE").val(),
                    level: '3'
                },

                success: function (states) {


                    $.each(states, function (i, state) {
                        $("#COMMUNE_CODE").append('<option value="' + state.Value + '">' +
                             state.Text + '</option>');


                    });
                },
                error: function (ex) {
                    alert('Failed to retrieve states.' + ex);
                }
            });
            return false;
        })
    });
</script>

@{
    ViewBag.Title = "Tạo mã đăng nhập";
    Layout = "~/Views/Shared/_LayoutBusiness.cshtml";
}


@model DHQGHN.PM2.ViewModels.Online.OnlineViewModels
@using (Html.BeginForm())
{
    <div class="container">
        <div class="row">
            <div class="col-md-2 text-right">
                @Html.LabelFor(m => m.PROVINCE_CODE, new { @class = "lable-control" })
            </div>
            <div class="col-md-2">
                @Html.DropDownListFor(m => m.PROVINCE_CODE, ViewData["DISTRICT_CODE"] as List<SelectListItem>, new { @class = "input-control" })
            </div>
        </div>
        <div class="row">
            <div class="col-md-2  text-right">
                @Html.LabelFor(m => m.DISTRICT_CODE, new { @class = "lable-control" })
            </div>
            <div class="col-md-2">
                @Html.DropDownListFor(m => m.DISTRICT_CODE, new SelectList(string.Empty, "Value", "Text"), "Chọn huyện", new { @class = "input-control" })
            </div>
        </div>
        <div class="row">
            <div class="col-md-2 text-right">
                @Html.LabelFor(m => m.COMMUNE_CODE, new { @class = "lable-control" })
            </div>
            <div class="col-md-2">
                @Html.DropDownListFor(m => m.COMMUNE_CODE, new SelectList(string.Empty, "Value", "Text"), "Chọn xã", new { @class = "input-control" })
            </div>
        </div>

        <div class="row">

            <div class="col-md-2 col-md-offset-2">
                <button type="submit">
                    Tìm kiếm
                </button>
            </div>
        </div>
        <div class="row">
            <div class="col-md-10 col-md-offset-2  text-danger">
                @ViewData["MESSAGE"]
            </div>

        </div>
    </div>
}
<script src="~/Scripts/index.js"></script>

